//
// Copyright (c) 2009 All Right Reserved
//
// vl
//
// 2009-01-01
// Contains ...
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using JetBrains.Annotations;
namespace LargoCommon.Music
{
///
/// Melodic Struct Collection.
///
[XmlRoot]
public sealed class MelodicStructureCollection : Collection {
#region Constructors
///
/// Initializes a new instance of the MelodicStructureCollection class.
///
public MelodicStructureCollection() {
}
///
/// Initializes a new instance of the MelodicStructureCollection class.
///
/// Given list.
public MelodicStructureCollection(IList givenList)
: base(givenList) {
}
#endregion
#region Properties
/// Gets list of all already defined tones.
/// Property description.
public string UniqueIdentifier {
get {
var ident = new StringBuilder();
ident.Append(string.Format(CultureInfo.CurrentCulture, "#{0}#", this.Count));
foreach (var sc in
this.Where(ms => ms.GetStructuralCode != null).SelectMany(ms => ms.GetStructuralCode)) {
ident.Append(sc); //// ElementSchema, DecimalNumber, ms.StructuralCode
}
return ident.ToString();
}
}
///
/// Is Equal To.
///
/// Melodic structure collection.
/// Returns value.
[Pure]
public bool IsEqualTo(MelodicStructureCollection melodicStructures) {
if (melodicStructures == null) {
return false;
}
return string.CompareOrdinal(this.UniqueIdentifier, melodicStructures.UniqueIdentifier) == 0;
}
#endregion
}
}